﻿<%@ Page Language="VB" AutoEventWireup="false"  MasterPageFile="~/Administrator/MasterPage.master"   CodeFile="AmountOfMonth.aspx.vb" Inherits="Administrator_AmountOfMonth" %>
 <%@ Register Assembly="DevExpress.Web.v14.1, Version=14.1.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxEditors" TagPrefix="dx" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <script src="../Scripts/JScript.js" type="text/javascript"></script>
   <script type="text/javascript">
       function numbersOnly(Sender, evt, isFloat, isNegative) {
           if (Sender.readOnly) return false;

           var key = evt.which || !window.event ? evt.which : event.keyCode;
           var value = Sender.value;

           if ((key == 46 || key == 44) && isFloat) {
               var selected = document.selection ? document.selection.createRange().text : "";
               if (selected.length == 0 && value.indexOf(".") == -1 && value.length > 0) Sender.value += ".";
               return false;
           }
           if (key == 45) { // minus sign '-'
               if (!isNegative) return false;
               if (value.indexOf('-') == -1) Sender.value = '-' + value; else Sender.value = value.substring(1);
               if (Sender.onchange != null) {
                   if (Sender.fireEvent) {
                       Sender.fireEvent('onchange');
                   } else {
                       var e = document.createEvent('HTMLEvents');
                       e.initEvent('change', false, false);
                       Sender.dispatchEvent(e);
                   }
               }

               var begin = Sender.value.indexOf('-') > -1 ? 1 : 0;
               if (Sender.setSelectionRange) {
                   Sender.setSelectionRange(begin, Sender.value.length);
               } else {
                   var range = Sender.createTextRange();
                   range.moveStart('character', begin);
                   range.select();
               }

               return false;
           }
           if (key > 31 && (key < 48 || key > 57)) return false;
       }


       var hasSubmitted = 0;
       function NoDoubleSubmit() {
           var divMsg = document.getElementById('Processing');
           if (hasSubmitted == 0) {
               hasSubmitted = 0;
               divMsg.style.display = 'block';
               return true;
           }
           return false;
       }

       function NoDoubleSave() {
           var divMsg = document.getElementById('Saving');
           if (hasSubmitted == 0) {
               hasSubmitted = 0;
               divMsg.style.display = 'block';
               return true;
           }
           return false;
       }
    </script>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode = "Conditional">
        <ContentTemplate>
            <table style="width:100%;">
                 <tr>
                    <td align="right">
                        <asp:Label ID="lblProduct" runat="server" CssClass="control"></asp:Label>
                    </td>
                    <td align="left">
                       <dx:ASPxComboBox ID="ddlProduct" runat="server" AutoPostBack="false" 
                                        BackColor="#FFCCCC" CssClass="control" Height="25px" 
                                        IncrementalFilteringMode="StartsWith" Width="150px" 
                            EnableIncrementalFiltering="True">
                       </dx:ASPxComboBox>
                        <asp:HiddenField ID="HiddenField1" runat="server" />
                        <asp:HiddenField ID="HiddenField2" runat="server" />
                    </td>
                  
                </tr>
                <tr>
                    <td align="right" width="150">
                        <asp:Label ID="lblSEQ" runat="server" CssClass="control"></asp:Label>
                    </td>
                    <td align="left" style="height: 26px">
                        <asp:TextBox ID="txtSEQ" runat="server" CssClass="control"   onkeypress='return numbersOnly(this,event,false,false);'
                            Height="20px" Width="170px" AutoCompleteType="Disabled" MaxLength="2"></asp:TextBox>
                    </td>
                    
                </tr>
                <tr>
                    <td align="right">
                        <asp:Label ID="lblDiscription" runat="server" CssClass="control"></asp:Label>
                    </td>
                    <td align="left">
                        <asp:TextBox ID="txtDiscription" runat="server" CssClass="control" 
                            Height="20px" Width="315px" AutoCompleteType="Disabled" MaxLength="50"></asp:TextBox>
                    </td>
                  
                </tr>
                <tr>
                    <td align="right">
                        <asp:Label ID="lblActive" runat="server" CssClass="control"></asp:Label>
                    </td>
                    <td align="left">
                        <asp:RadioButton ID="rbtACTIVE"  runat="server"  GroupName="ACTIVE" />
                        <asp:RadioButton ID="rbtDeACTIVE" runat="server" GroupName="ACTIVE" />
                    </td>
                </tr>
                <tr>
                    <td align="right">
                        &nbsp;</td>
                    <td align="left" style="text-align: right">
                        <asp:Button ID="btnSearch" runat="server" CssClass="control" 
                            Text="search" Width="80px" />
                        <asp:Button ID="btnAdd" runat="server" CssClass="control" Text="Add" 
                            Width="80px" />
                        <asp:Button ID="btnModify" runat="server" CssClass="control" Text="Modify" 
                            Width="80px" />
                        <asp:Button ID="btnDelete" runat="server" CssClass="control" Text="Delete" 
                            Width="80px" />
                        <asp:Button ID="btnClear" runat="server" CssClass="control" Text="Clear"  
                            Width="81px" />
                        <asp:Button ID="btnPrint" runat="server" CssClass="control" Text="Print" 
                            Width="80px"  />
                    </td>
               
                </tr>
                  <tr>
                    <td colspan="2" align="center">
                        <asp:Label ID="Label1" runat="server" CssClass="control" Font-Bold="True" ForeColor="Red"
                            Text="ไม่พบข้อมูล" Visible="False" Font-Size="X-Large" Height="30px"></asp:Label>
                        <span id="Processing" style="display: none">
                            <img src="../img/icon/ajax-loader.gif" alt="Please wait" />
                            กรุณารอสักครู่ ระบบกำลังค้นหาข้อมูล... </span>
                        <span id="Saving" style="display: none">
                            <img src="../img/icon/ajax-loader.gif" alt="Please wait" />
                            กรุณารอสักครู่ ระบบกำลังบันทึกข้อมูล... </span>
                    </td>
                </tr>
            </table>
           <div align="center">

        <asp:Label ID="lblMsg" runat="server" CssClass="control" Font-Size="XX-Large" 
                        ForeColor="Red" Height="30px" style="text-align: center" 
                   Font-Bold="True"></asp:Label>

            <asp:GridView ID="gvAmountOfMonth" runat="server" AllowSorting="True" 
                AutoGenerateColumns="False" CellPadding="4" CssClass="control" 
                ForeColor="#333333" Width="100%" AllowPaging="True" 
                   EnableSortingAndPagingCallbacks="True">
                <RowStyle BackColor="#FFFBD6" ForeColor="#333333" />
                <FooterStyle BackColor="White" Font-Bold="True" ForeColor="#333333" />
                <RowStyle ForeColor="#333333" />
                <PagerSettings Mode="NumericFirstLast" />
                <PagerStyle BackColor="#FFCC66" ForeColor="#333333" HorizontalAlign="Center" 
                    CssClass="cssPager" />
                <SelectedRowStyle BackColor="#FFFFCC" Font-Bold="True" ForeColor="Navy" />
                <HeaderStyle BackColor="#E38120" Font-Bold="True" ForeColor="White" />
                <AlternatingRowStyle BackColor="White" />
                <Columns>
                    <asp:CommandField ButtonType="Image" 
                        SelectImageUrl="~/img/icon/select_icon.gif" ShowSelectButton="True">
                    <ItemStyle Width="3%"  />
                    </asp:CommandField>

                    <asp:BoundField DataField="SEQ" HeaderText="ลำดับ" ReadOnly="True" 
                        SortExpression="SEQ">
                    <ItemStyle HorizontalAlign="Center" Width="12%" />
                    </asp:BoundField> 

                  
                    <asp:BoundField DataField ="PRODUCTNAME" HeaderText="ผลิถภัณฑ์" ReadOnly="true" SortExpression="ผลิถภัณฑ์">
                    <ItemStyle HorizontalAlign="Center" Width="12%" />
                     </asp:BoundField> 

                    <asp:BoundField DataField="DESCRIPTION" HeaderText="รายละเอียด" ReadOnly="True"  
                        SortExpression="DESCRIPTION">
                    <ItemStyle HorizontalAlign="Left"   />
                    </asp:BoundField>

                      <asp:TemplateField SortExpression="ACTIVE" HeaderText="สถานะการใช้ข้อมูล">
                        <ItemTemplate>
                            <asp:Label ID="grd_lbl_ACTIVE" runat="server"></asp:Label>
                            <asp:HiddenField ID="grd_hid_ACTIVE" runat="server"/>
                        </ItemTemplate>
                        <ItemStyle Width="150px" />
                    </asp:TemplateField>
                       <asp:BoundField DataField="PRODUCTCODE" HeaderText="PRODUCTCODE" ReadOnly="True" 
                        SortExpression="SEQ" Visible="False">
                    <ItemStyle HorizontalAlign="Center" Width="12%" />
                    </asp:BoundField>

                </Columns>
            </asp:GridView>
            </div>
            <div align="right">
                <asp:Label ID="lblTotal" runat="server" Font-Bold="True" ForeColor="#003300"></asp:Label>
            </div>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>